<?php
if (!defined("IN_OP"))
{
    exit("You can't access this file directly...");
}

$ui = new UI(true,'',true);
$tpl = new Template_Member();
$tpl->load(array("main" => "6h/lm.tpl", "menu" => "6h/6h_menu.tpl","header"=>"game_header.tpl","foot"=>"game_foot.tpl"));
$tpl->set($fp," class='select'");
$tpl->set('tblName','六合彩');
$tpl->show("menu");
if ($curruser['enabled'] != 1)
{
    $ui->showErrorPage("<p class=error>帐号已被暂停使用</p>");
    exit();
}
$rs = getdb("select * from lotto where open>='" . date("Y-m-d") . "' order by open limit 1");
if ($rs->eof)
{
    $ui->showErrorPage("<div class='time'><div class='timeDiv2'>以官方公告为准</div></div>");
    exit();
}
$open = $rs->f['open'];
$round = $rs->f['round'];
$lotto_id = $rs->f['id'];
$stopbet = $conf->get("stopbet");
if (date("Y-m-d") < $open)
{
    $ui->showErrorPage("<div class='time'><div class='timeDiv2'>以官方公告为准</div></div>");
    exit();
}
else if (date("Y-m-d") == $open)
{
    if ($stopbet <= date("Hi"))
    {
        $ui->showErrorPage("<div class='time'><div class='timeDiv2'>以官方公告为准</div></div>");
        exit();
    }
    else if (date("Hi") <= $conf->get("startbet"))
    {
        $ui->showErrorPage("<p class=error>目前非下单时段</p><script>setTimeout('location.reload()',30000);</script>");
        exit();
    }
}
$tpl->set("cchinayear", intval($conf->get("chinayear")));
$t1 = strtotime($open . " " . $stopbet);
$tpl->Set("timestap", $t1 - systime());
$tpl->set("phptime", systime());
$tpl->set("open", $open);
$tpl->set("round", d3($round));
$tpl->set("lotto_id", $lotto_id);
$tpl->set("betName","连码");
$tpl->set("gametype",0);

$select_disk = getUserValidDiskSelect($curruser, "document.location='op.php?op=member&fp=bet5&disk='+this.value");
$tpl->set("select_disk", $select_disk);
$disk = $g_disk_code[getUserValidDisk( $curruser )];
$rs = getdb( "select * from rate5{$disk} where lotto_id={$lotto_id} LIMIT 1" );
if ( $rs->eof )
{
    $ui->showErrorPage( "<p class=error>系统目前维护中，请稍後！</p>" );
    exit();
}
$tpl->set( "r9_1", floatval($rs->f['r9_1']) );
$tpl->set( "r9_2", floatval($rs->f['r9_2']) );
$tpl->set( "r7_1", floatval($rs->f['r7_1']) );
$tpl->set( "r10_1", floatval($rs->f['r10_1']) );
$tpl->set( "r10_2", floatval($rs->f['r10_2']) );
$tpl->set( "r11_1", floatval($rs->f['r11_1']) );
$tpl->set( "maxnum",$conf->get("line_max_count"));
$diskTempArr = array( "a" => 1, "b" => 2, "c" => 3, "d" => 4 );
$rs = getdb( "select * from rate8 where lotto_id={$lotto_id} AND disk = {$diskTempArr[$disk]} LIMIT 1" );
if ( $rs->eof )
{
    $ui->showErrorPage( "<p class=error>系统目前维护中，请稍後！</p>" );
    exit();
}
else
{
    $rate8Arr = array();
    $i = 1;
    while ( $i < 50 )
    {
        $rate8Arr["r29_{$i}"] = floatval( $rs->f["r".d2( $i )] );
        ++$i;
    }
    $tpl->set( $rate8Arr );
}
$rs->close();
sort( $rate8Arr );
$tpl->set( array( "r8_max" => $rate8Arr[48], "r8_min" => $rate8Arr[0] ) );
$rate9Arr=array();
$rs = getdb( "select * from rate9 where lotto_id={$lotto_id} AND disk = {$diskTempArr[$disk]} LIMIT 1" );
if ( $rs->eof )
{
    $ui->showErrorPage( "<p class=error>系统目前维护中，请稍後！</p>" );
    exit();
}
else
{
    $rate8Arr = array();
    $i = 1;
    while ( $i < 50 )
    {
        $rate9Arr["r48_{$i}"] = floatval( $rs->f["r".d2( $i )] );
        ++$i;
    }
    $tpl->set( $rate9Arr );
}
$rs->close();
sort( $rate9Arr );
$tpl->set( array( "r9_max" => $rate9Arr[48], "r9_min" => $rate9Arr[0]) );

$tpl->show("header");
$tpl->show("main");
$tpl->show("foot");
?>